package com.ruoyi.manage.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.manage.mapper.BadEventMapper;
import com.ruoyi.manage.domain.BadEvent;
import com.ruoyi.manage.service.IBadEventService;

/**
 * 不良事件字典Service业务层处理
 * 
 * @author liuyangyang
 * @date 2025-05-29
 */
@Service
public class BadEventServiceImpl implements IBadEventService 
{
    @Autowired
    private BadEventMapper badEventMapper;

    /**
     * 查询不良事件字典
     * 
     * @param badId 不良事件字典主键
     * @return 不良事件字典
     */
    @Override
    public BadEvent selectBadEventByBadId(Long badId)
    {
        return badEventMapper.selectBadEventByBadId(badId);
    }

    /**
     * 查询不良事件字典列表
     * 
     * @param badEvent 不良事件字典
     * @return 不良事件字典
     */
    @Override
    public List<BadEvent> selectBadEventList(BadEvent badEvent)
    {
        return badEventMapper.selectBadEventList(badEvent);
    }

    /**
     * 新增不良事件字典
     * 
     * @param badEvent 不良事件字典
     * @return 结果
     */
    @Override
    public int insertBadEvent(BadEvent badEvent)
    {
        badEvent.setCreateTime(DateUtils.getNowDate());
        return badEventMapper.insertBadEvent(badEvent);
    }

    /**
     * 修改不良事件字典
     * 
     * @param badEvent 不良事件字典
     * @return 结果
     */
    @Override
    public int updateBadEvent(BadEvent badEvent)
    {
        badEvent.setUpdateTime(DateUtils.getNowDate());
        return badEventMapper.updateBadEvent(badEvent);
    }

    /**
     * 批量删除不良事件字典
     * 
     * @param badIds 需要删除的不良事件字典主键
     * @return 结果
     */
    @Override
    public int deleteBadEventByBadIds(Long[] badIds)
    {
        return badEventMapper.deleteBadEventByBadIds(badIds);
    }

    /**
     * 删除不良事件字典信息
     * 
     * @param badId 不良事件字典主键
     * @return 结果
     */
    @Override
    public int deleteBadEventByBadId(Long badId)
    {
        return badEventMapper.deleteBadEventByBadId(badId);
    }
}
